﻿using mars_client.csharp.cache;
using mars_client.csharp.enums;
using mars_client.csharp.model;
using mars_client.csharp.vo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using mars_client.csharp.model.vo;
using mars_client.csharp.radar;

namespace mars_client.gui.window
{
    /// <summary>
    /// VerifyWindow.xaml 的交互逻辑
    /// </summary>
    public partial class VerifyWindow : Window
    {
        public VerifyWindow()
        {
            InitializeComponent();
        }

        private void disagree(object sender, MouseButtonEventArgs e)
        {
            TextBlock tblock = (TextBlock)sender;
            MessageCO messageCO = new MessageCO();
            messageCO.type = (int)RequestEnum.request.AddFriendNotify;
            FriendNotifyVO friendNotifyVO = new FriendNotifyVO();
            friendNotifyVO.isAgree = -1;
            friendNotifyVO.receiverVO = UserCache.Instance.userVO;
            friendNotifyVO.senderVO = new UserVO();
            friendNotifyVO.senderVO.id = long.Parse(tblock.Uid);
            messageCO.content = friendNotifyVO;

            Radar.Instance.sendData(messageCO);
            this.Close();
        }

        private void agree(object sender, MouseButtonEventArgs e)
        {
            TextBlock tblock = (TextBlock)sender;
            MessageCO messageCO = new MessageCO();
            messageCO.type = (int)RequestEnum.request.AddFriendNotify;
            FriendNotifyVO friendNotifyVO = new FriendNotifyVO();
            friendNotifyVO.isAgree = 1;
            friendNotifyVO.receiverVO = UserCache.Instance.userVO;
            friendNotifyVO.senderVO = new UserVO();
            friendNotifyVO.senderVO.id = long.Parse(tblock.Uid);
            messageCO.content = friendNotifyVO;

            Radar.Instance.sendData(messageCO);
            this.Close();
        }

        private void Canvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
    }
}
